<?php
namespace V2;
class C_UserCenter extends \ResourceClass
{
    public $isActive = true;
    public $remark = '个人';

    public function get(array $req, array $post, &$result)
    {
        if (!isset($req['uid'])) {
            return 'require user uid';
        }
        if (!isset($req['userType'])) {
            return 'require user type';
        }
        if (!isset($req['k']) || !isset($req['t'])) {
            return 'data error';
        }
        $user_cls = \Biz\UserHandler::getById($req['userType'], $req['uid']);
        $enterprise_id = $user_cls->getEnterpriseId();
        /* 授权验证*/
        if (\Biz\UserHandler::checkAuth($req['userType'], $req['uid'], $enterprise_id, $req['id'] . $req['t'] . $post['payload'], $req['k']) == false) {
            return 'data illegal';
        }
        //feedback 1有未读 0 没有未读
        $user_handler = new \Biz\CustomerFeedbackHandler();
        $new_feedback = $user_handler->getFeedbackStyleByUid($req['uid']);
        $result = array('new_feedback' => $new_feedback, 'new_message' => 0, 'new_version' => 0, 'new_style' => 0);
    }
}